<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<div class="button_area">
	<a class="button submit">保存</a>&nbsp;&nbsp;
	<a href="task/task.action" class="button">返回</a>
</div>
<s:form method="post" action="taskUpdate" namespace="/task">
	<s:hidden name="task.taskId"></s:hidden>
	<tr>
		<td>
			<table class="form_table">
				<s:textfield label="任务名称" name="task.taskName"  id="task_taskName" size="18"
					required="true" maxlength="100"></s:textfield>
				<s:textfield label="任务开始时间" name="task.startTime"  id="task_startTime" size="18"
					 required="true" maxlength="100"></s:textfield>
				<s:textfield label="任务结束时间" name="task.endTime" id="task_endTime" size="18"
					required="true" maxlength="20"></s:textfield>
				<s:textfield label="任务地点" name="task.taskAddress" size="18"
					maxlength="20"></s:textfield>
				<s:textfield label="任务地点经度" name="task.lat" size="18"
					required="true" maxlength="20"></s:textfield>
				<s:textfield label="任务地点纬度" name="task.lon"  size="18"
					required="true" maxlength="20"></s:textfield>
				<s:select label="分配给" list="users"
					name="task.user.userId" listKey="userId" listValue="phoneNumber"
					>
				</s:select>
		
			</table>
		</td>

	</tr>
	<tr>
		<td colspan="15">
			<table class="form_table">
				<s:textarea label="任务说明" name="task.taskDetails" cssStyle="width:600px"></s:textarea>
			</table>
		</td>
	</tr>

</s:form>



<script type="text/javascript">

  $(document).ready(function(){
  
  	$('#task_startTime').datetimepicker();
  	$('#task_endTime').datetimepicker();  	
    $("form").validate({
    	errorLabelContainer: $("div.error"),
    	focusInvalid: true,
    	rules: {           //定义验证规则,其中属性名为表单的name属性  
        	'task.taskName': {  
        		required: true,  
               	
              	},
             'task.startTime': {  
        		required: true,  
               	
              	},
              'task.endTime': {  
        		required: true,  
               	
              	},	
              'task.lat': {  
        		required: true,  
        		number: true,
               	
              	},
        	  'task.lon': {  
        		required: true,  
        		number: true,
               	
              	}
			
         }, 
         messages: {       //自定义验证消息  
         	'task.taskName': {  
            	required: "任务名称是必需的<br>" 
         	},
         	'task.startTime': {  
            	required: "任务开始时间是必需的<br>"
         	},
         	'task.endTime': {  
            	required: "任务结束时间是必需的<br>"
         	},
         	'task.lat': {  
            	required: "任务地点经度是必需的<br>",
            	number:  "任务地点经度必需是数字<br>"
         	},
         	'task.lon': {  
            	required: "任务地点纬度是必需的<br>",
            	number:  "任务地点纬度必需是数字<br>"
         	}
         }
    });
  });
 
//-->
</script>